package main

import (
	"fmt"
	"reflect"
	"strconv"
	"strings"
	"unsafe"
)

func main() {

}

func te1(s string, v ...interface{}) string {
	s = fmt.Sprintf(s, v...)
	return s
}

func te2(s string, v ...interface{}) string {
	s1 := fmt.Sprintf(s, v)
	return s1
}

func convertTest() {
	var f float32 = 34243.24
	var b byte = 'g'
	f1 := float64(f)
	s := strconv.FormatFloat(f1, b, 1, 64)
	fmt.Println(s)
	fmt.Println(reflect.TypeOf(s).Kind())
}

func replace() {
	str := "sssaa"
	str = strings.Replace(str, "s", "a", -1)
	fmt.Println(str)
}

func unsafeTest1() {
	var str string = "hi,李里~"

	p := (*struct {
		str uintptr
		len int
	})(unsafe.Pointer(&str))
	fmt.Printf("%+v\n", p)
}

func unsafeTest1_1() {
	var s string
	str := "hi,world"
	p := (*testUnsafe)(unsafe.Pointer(&str))
	fmt.Println(p)
	fmt.Println(s)
}

type testUnsafe struct {
	str  uintptr
	len  int
	word unsafe.Pointer
}
